#include <iostream>
#include <string>

#include "TestArray.h"
#include "Array1D.h"
#include "Array2D.h"
#include "Vector.h"
#include "Matrix.h"
#include "LinearEquation.h"

using namespace typl;
using namespace ypl;

void TestArray::run()
{
    std::cout << "Testing Module Array, begin." << std::endl;

    Array1D<Real> a1(2, 1.0);
    std::cout << "a1 = " << a1;

    Array2D<Real> a2(3, 2, 1.0);
    std::cout << "a2 = " << a2;

    Vector<Real> v(2, 1.0);
    std::cout << "v = " << v;

    Matrix<Real> m(3, 2, 1.0);
    std::cout << "m = " << m;

    Matrix<Real> mt = m.transpose();
    std::cout << "mt = " << mt;
    std:: cout << "m*v = " << m*v;

    Integral n = 2;
    Matrix<Real> A(n, n, 0.0);
    Vector<Real> b(n, 1);
    for (Integral i = 0; i < n; ++i)
    {
        A[i][i] = 2;
    }
    LinearEquation<Real> linEqu(A,b);
    Vector<Real> x;
    linEqu.getSolution(x);

    std::cout << "Equation Ax=b, A = " << A
              << "b = " << b
              << "x = " << x;


    std::cout << "Testing Module Array, end." << std::endl;
}
